//
// Created by spiro on 19-3-4.
//

#include <stdio.h>
#define SIZE 10
int sum(int * ar, int * ar_end);

int main(void) {
    int marbles[SIZE] = {20, 10, 5, 39, 4, 16, 19, 26, 31, 20};
    int answer;

    answer = sum(marbles, marbles + SIZE);
    printf("The total number of marbles is %d.\n", answer);
    printf("The size of marbles is %zd bytes.\n", sizeof(marbles));

    return 0;
}

int sum(int * ar, int * ar_end) {
    int total = 0;

    while (ar < ar_end) {
        total += *ar;
        ar++;
    }

    return total;
}